package com.huiyou.adminapi.common.model;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

@Data
@Entity
@Table(name = "area_info")
public class AreaInfo {

    @Id
    @GenericGenerator(name = "jpa-uuid", strategy = "uuid2")
    @GeneratedValue(generator = "jpa-uuid")
    private String id;

    private String ipAddress;

    private String ipJoinSecurity;

    private String city;

    private String county;

    @ManyToOne
    @NotFound(action= NotFoundAction.IGNORE)
    @JsonIgnoreProperties({"areaInfoList"})
    private PseudoCode pseudo;

    @Override
    public String toString() {
        return "AreaInfoDTO{" +
            "id='" + id + '\'' +
            ", ipAddress='" + ipAddress + '\'' +
            ", ipJoinSecurity='" + ipJoinSecurity + '\'' +
            ", city='" + city + '\'' +
            ", county='" + county + '\'' +
            '}';
    }
}
